//
//  ScanService.m
//  Nurse
//
//  Created by 夏 申频 on 14-1-12.
//  Copyright (c) 2014年 Honeywell. All rights reserved.
//

#import "ScanService.h"

@implementation ScanService

NSString* const NOTIFICATIONReceivedScanData =@"NOTIFICATIONReceivedScanData";

+(ScanService*) sharedInstance{
    static dispatch_once_t pred = 0;
    __strong static id _sharedObject = nil;
    dispatch_once(&pred, ^{
        _sharedObject = [[ScanService alloc] init];
    });
    return _sharedObject;
}

-(void)postDataReceivedNotify:(NSString*)data andviewname:(NSString *)viewname{
    NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
    NSNotification* notification;
    if ([viewname isEqualToString:@"bed"])
    {
     notification= [NSNotification notificationWithName:@"bed" object:self userInfo:@{@"data":data}];
    }
    if ([viewname isEqualToString:@"duty"])
    {
        notification= [NSNotification notificationWithName:@"duty" object:self userInfo:@{@"data":data}];
    }
    
    if ([viewname isEqualToString:@"PatientInfoView"])
    {
        notification= [NSNotification notificationWithName:@"PatientInfoView" object:self userInfo:@{@"data":data}];
    }
    if ([viewname isEqualToString:@"PersonalDutyView"])
    {
        notification= [NSNotification notificationWithName:@"PersonalDutyView" object:self userInfo:@{@"data":data}];
    }
    if ([viewname isEqualToString:@"TurnView"])
    {
        notification= [NSNotification notificationWithName:@"TurnView" object:self userInfo:@{@"data":data}];
    }
    
    [nc postNotification:notification];
}




@end
